@extends('layouts.index')
@section('title', '购物车')
@section('content')
  <div class="layui-row">
      <div class="content content-nav-base shopcart-content">
        <div class="cart w1200">
          <div class="cart layui-col-md12">
            <div class="cart-table-th layui-hide-xs">
              <div class=" layui-col-md1 ">
                <div class="select-all">
                  <div class="cart-checkbox">
                    <input class="check-all check" id="allCheckked" type="checkbox" value="true">
                  </div>
                  <label>&nbsp;&nbsp;全选</label>
                </div>
              </div>
              <div class="layui-col-xs2 layui-col-md3 tg th">
                <div class="th-inner">
                  商品
                </div>
              </div>
              <div class="layui-col-xs2 layui-col-md2 th">
                <div class="th-inner">
                  单价
                </div>
              </div>
              <div class="layui-col-xs2 layui-col-md2 th">
                <div class="th-inner">
                  数量
                </div>
              </div>
              <div class="layui-col-xs2 layui-col-md2 th">
                <div class="th-inner">
                  小计
                </div>
              </div>
              <div class="layui-col-xs2 layui-col-md1 th">
                <div class="th-inner">
                  操作
                </div>
              </div>
            </div>
          </div>
          {{--适配小屏幕--}}
          <div class="OrderList">
            <div class="order-content" id="list-cont">
              @foreach($cartItems as $item)
                <ul class="item-content layui-clear"  data-id="{{ $item->productSku->id }}">
                <li class="th th-chk layui-col-xs1 layui-col-md1">
                  <div class="select-all">
                    <div class="cart-checkbox">
                      <input class="CheckBoxShop check" id="" type="checkbox" num="all" name="select" value="{{ $item->productSku->id }}" {{ $item->productSku->product->on_sale ? 'checked' : 'disabled' }}>
                    </div>
                  </div>
                </li>
                <li class="th th-item layui-col-xs3 layui-col-md3">
                  <div class="item-cont">
                    <a href="{{ route('products.show', [$item->productSku->product_id]) }}"><img src="{{ $item->productSku->product->image_url }}" alt=""></a>
                  </div>
                </li>
                <li class="th th-item layui-col-xs7" style="margin-left: 10px;">
                  <div class="layui-row">
                    <div class="layui-col-xs12 kaisou-pruduct-profile">
                      <div @if(!$item->productSku->product->on_sale) class="not_on_sale"@else  class="text" @endif>
                        <a  class="title" target="_blank" href="{{ route('products.show', [$item->productSku->product_id]) }}">{{ $item->productSku->product->title }}</a>
{{--                        <div class="title">PHP是世界上最好的编程语言！</div>--}}
                        <p style="visibility: hidden;"><span>{{ $item->productSku->title }}</span></p>
                      @if(!$item->productSku->product->on_sale)
                        <span class="warning">该商品已下架</span>
                      @endif
                      </div>
                    </div>
                    <div class="layui-col-xs6 layui-col-md12">
                      <div class="layui-row">
                        <div class="layui-col-xs6 pro-unit">
                          <span class="th-su">{{ $item->productSku->price }}</span>
                        </div>
                        <span class="sum">{{ $item->productSku->price }}</span>
                      </div>
                    </div>
                  </div>
                </li>
                <li class="th th-item layui-col-xs12" style="margin-top: 10px;">
                  <div class="layui-col-xs6 kaisou-price layui-col-md4">
                    <div class="box-btn layui-clear">
                      <div class="less layui-btn">-</div>
                      <input class="Quantity-input" type=""@if(!$item->productSku->product->on_sale) disabled @endif name="amount" value="{{ $item->amount }}" disabled="disabled" >
                      <div class="add layui-btn">+</div>
                    </div>
                  </div>
                  <div class="th th-op layui-col-xs2 layui-col-md4">
                    <span class="dele-btn">删除</span>
                  </div>
                </li>
              </ul>
              @endforeach
        </div >
          </div>
        <div class="FloatBarHolder layui-clear">
          <div class="th th-chk">
            <div class="select-all">
              <div class="cart-checkbox">
                <input class="check-all check" id="" name="select-all" type="checkbox"  value="true">
              </div>
              <label>&nbsp;&nbsp;已选<span class="Selected-pieces">0</span>件</label>
            </div>
          </div>
          <div class="th batch-deletion">
            <span class="batch-dele-btn">批量删除</span>
          </div>
          <div class="th Settlement">
            <button class="layui-btn">结算</button>
          </div>
          <div class="th total">
            <p>应付：<span class="pieces-total">0</span></p>
          </div>
        </div>
      </div>
    </div>

  </div>

</div>
@section('scriptsAfterJs')
<script type="text/javascript">
  layui.config({
    base: '/res/layui/util/' //你存放新模块的目录，注意，不是layui的模块目录
  }).use(['mm','jquery','element','car'],function(){
    var mm = layui.mm,$ = layui.$,element = layui.element,car = layui.car;
    car.init()
});
</script>
@endsection
@endsection
